package guoanmaker.operator.business.service;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import guoanmaker.operator.business.dao.OperatorAppraiseDao;
import guoanmaker.operator.business.model.PersonalAppraise;
import guoanmaker.operator.business.repository.PersonalAppraiseRepository;

@Service
public class AppraiseService {

	@Autowired
	OperatorAppraiseDao operatorAppraiseDao;
	@Autowired
	PersonalAppraiseRepository personalAppraiseRepository;

	private void setVisible(String id,String isShow) {
		PersonalAppraise personalAppraise = personalAppraiseRepository.findOne(id);
		personalAppraise.setIsShow(isShow);
		personalAppraiseRepository.save(personalAppraise);
	}

	public void setVisible(String[] ids,String isShow) {
		for (String id : ids) {
			this.setVisible(id, isShow);
		}
	}
	
	public Map<String, Object> findAppraiseByParameters(int page, int pageSize, String orderNumber, String appraiseKind,
			String appraisePhone, String goodNumber, String shopName, String beginDate, String endDate) {
		
		return operatorAppraiseDao.findAppraiseByParameters(page, pageSize, orderNumber, appraiseKind, appraisePhone,
				goodNumber, shopName, beginDate, endDate);
	}

}
